<?php
/**
 * Checklists Elements
 *
 * @author Xavier VILAIN
 * @package Nawa\MedicalStudy
 * @license #licence#
 * 
 */

use Fox\Generator;
use Nawa\Survey;
use Fox\Html\DropList;
use Fox\Html\Block;

$bChecklist = new Block('checklists',Msg(Nawa\Messages::BUNDLE,Nawa\Messages::CHECKLIST_SELECTION));
$categories = \Fox\Dao::finder(Nawa\Survey\Category::className())
				->where('domain = ?',array(Nawa\MedicalStudy::DOMAIN_MEDICAL_STUDY))
				->find();
				
foreach($categories as $category) {
	$surveys = Fox\Dao::finder(Survey::className())
				->where('category = ?',array($category->getId()))
				->find();
	$bChecklist->add(new DropList('category_'.$category->getId(),true,false,true))
			->label($category->label())
			->options($surveys,'surveyid',Generator::call('label'));		
}
$bChecklist->collapsed(false);
return $bChecklist;